<template>
	<view class="indexs">
		<view class="header header_wi" :style="'padding-top: ' + navH + 'px;'">
			<view class="header_height" :style="'height:' + gaodu + 'px;line-height:' + gaodu + 'px;top:' + gaodutops + 'px;'">
				<view class="index_h_cont3">
					<view class="index_wenben_img" @tap="jumpzuo"><image :src="imgUrl + '/dzx_img33.png'" mode="widthFix"></image></view>
					<view class="index_wenben">{{ $t('page_dairuku_xq.package_details') }}</view>
				</view>
			</view>
			<view class="coloe_title">s</view>
		</view>
		<view class="index_center" :style="'padding-top:' + (navH + 50) + 'px;'">
			<view class="dairuku_xgxx">
				<view class="dairuku_xgxx_item1">
					<view class="dairuku_xgxx_item1_title">{{ $t('page_dairuku_xq.package_information') }}</view>
					<view class="dairuku_xgxx_item1_list">
						<view class="dairuku_xgxx_item1_cont" v-if="arrlist.express_name">
							<view class="dairuku_top_l">
								<image :src="imgUrl + '/dzx_img26.png'"></image>
								<text>{{ $t('page_dairuku_xq.courier_name') }}</text>
							</view>
							<view class="dairuku_top_r">
								<text>{{ arrlist.express_name }}</text>
							</view>
						</view>
						<view class="dairuku_xgxx_item1_cont">
							<view class="dairuku_top_l">
								<image :src="imgUrl + '/dzx_img27.png'"></image>
								<text>{{ $t('page_dairuku_xq.parcel_no') }}</text>
							</view>
							<view class="dairuku_top_r">
								<text>{{ arrlist.express_num }}</text>
								<view class="cangkudizhi_item1_t3" @tap="fuzhi" :data-name="arrlist.express_num">{{ $t('page_dairuku_xq.copy_tracking_number') }}</view>
							</view>
						</view>
						<view class="dairuku_xgxx_item1_cont">
							<view class="dairuku_top_l">
								<image :src="imgUrl + '/dzx_img27.png'"></image>
								<text>{{ $t('page_dairuku_xq.parcel_weight') }}</text>
							</view>
							<view class="dairuku_top_r">
								<text>{{ arrlist.weight }}{{ weight_mode.unit }}</text>
							</view>
						</view>
						<view class="dairuku_xgxx_item1_cont">
							<view class="dairuku_top_l">
								<image :src="imgUrl + '/dzx_img23.png'"></image>
								<text>{{ $t('page_dairuku_xq.sending_country') }}</text>
							</view>
							<view class="dairuku_top_r">
								<text>{{ arrlist.country?arrlist.country.title:$t('page_index.unknown') }}</text>
							</view>
						</view>
						<view class="dairuku_xgxx_item1_cont">
							<view class="dairuku_top_l">
								<image :src="imgUrl + '/dzx_img24.png'"></image>
								<text>{{ $t('page_dairuku_xq.consolidation_warehouse') }}</text>
							</view>
							<view class="dairuku_top_r">
								<text>{{ arrlist.storage?arrlist.storage.shop_name:'' }}</text>
							</view>
						</view>
						<view class="dairuku_xgxx_item1_cont">
							<view class="dairuku_top_l">
								<image :src="imgUrl + '/dzx_img27.png'"></image>
								<text>{{ $t('page_my_dingdan_details.selected_line') }}</text>
							</view>
							<view class="dairuku_top_r">
								<text>{{ arrlist.line?arrlist.line.name:'' }}</text>
							</view>
						</view>
						<view class="dairuku_xgxx_item1_cont" v-if="arrlist.usermark && setting.is_usermark==1">
							<view class="dairuku_top_l">
								<image :src="imgUrl + '/dzx_img26.png'"></image>
								<text>{{ $t('page_indexs_dairuku.usermark') }}</text>
							</view>
							<view class="dairuku_top_r">
								<text>{{ arrlist.usermark }}</text>
							</view>
						</view>
					</view>
				</view>

				<view class="dairuku_xgxx_item1">
					<view class="dairuku_xgxx_item1_title">{{ $t('page_dairuku_xq.goods_info') }}</view>
					<view class="dairuku_xgxx_item1_list" v-for="(items,index) in arrlist.item" :key="index">
						<uni-collapse ref="collapse">
						<uni-collapse-item :open="opentrue" :title="$t('page_baoguoyg.pinming') + '：' + items.goods_name" show-animation="true"> 
						<view class="dairuku_xgxx_item1_cont">
							<view class="dairuku_top_l">
								<image :src="imgUrl + '/dzx_img28.png'"></image>
								<text>{{ $t('page_dairuku_xq.commodity_category') }}</text>
							</view>
							<view class="dairuku_top_r">
								<text>{{ items.goods_name }}</text>
							</view>
						</view>
						<view class="dairuku_xgxx_item1_cont" v-if="items.goods_name_jp">
							<view class="dairuku_top_l">
								<image :src="imgUrl + '/dzx_img30.png'"></image>
								<text>{{ $t('page_baoguoyg.goods_name_jp') }}</text>
							</view>
							<view class="dairuku_top_r">
								<text>{{ items.goods_name_jp }}</text>
							</view>
						</view>
						<view class="dairuku_xgxx_item1_cont" v-if="items.class_name_en">
							<view class="dairuku_top_l">
								<image :src="imgUrl + '/dzx_img30.png'"></image>
								<text>{{ $t('page_baoguoyg.goods_name_en') }}</text>
							</view>
							<view class="dairuku_top_r">
								<text>{{ items.class_name_en }}</text>
							</view>
						</view>
						<view class="dairuku_xgxx_item1_cont"  v-if="items.one_price">
							<view class="dairuku_top_l">
								<image :src="imgUrl + '/dzx_img29.png'"></image>
								<text>{{ $t('page_dairuku_xq.commodity_value') }}</text>
							</view>
							<view class="dairuku_top_r">
								<text>{{ price_mode.unit }}{{ items.one_price }}</text>
							</view>
						</view>
						<view class="dairuku_xgxx_item1_cont" v-if="items.all_price">
							<view class="dairuku_top_l">
								<image :src="imgUrl + '/dzx_img29.png'"></image>
								<text>{{ $t('page_dairuku_xq.commodity_value') }}</text>
							</view>
							<view class="dairuku_top_r">
								<text>{{ price_mode.unit }}{{ items.all_price }}</text>
							</view>
						</view>
						<view class="dairuku_xgxx_item1_cont" v-if="items.product_num">
							<view class="dairuku_top_l">
								<image :src="imgUrl + '/dzx_img29.png'"></image>
								<text>{{ $t('page_baoguoyg.shuliang') }}</text>
							</view>
							<view class="dairuku_top_r">
								<text>{{ items.product_num }}</text>
							</view>
						</view>
						<view class="dairuku_xgxx_item1_cont" v-if="items.brand">
							<view class="dairuku_top_l">
								<image :src="imgUrl + '/dzx_img30.png'"></image>
								<text>{{ $t('page_baoguoyg.brand') }}</text>
							</view>
							<view class="dairuku_top_r">
								<text>{{ items.brand }}</text>
							</view>
						</view>
						<view class="dairuku_xgxx_item1_cont" v-if="items.spec">
							<view class="dairuku_top_l">
								<image :src="imgUrl + '/dzx_img30.png'"></image>
								<text>{{ $t('page_baoguoyg.spec') }}</text>
							</view>
							<view class="dairuku_top_r">
								<text>{{ items.spec }}</text>
							</view>
						</view>
						<view class="dairuku_xgxx_item1_cont" v-if="items.weight">
							<view class="dairuku_top_l">
								<image :src="imgUrl + '/dzx_img50.png'"></image>
								<text>{{ $t('page_dairuku_xq.parcel_weight') }}</text>
							</view>
							<view class="dairuku_top_r">
								<text>{{ items.weight }}{{ weight_mode.unit }}</text>
							</view>
						</view>
						</uni-collapse-item>
						</uni-collapse>
						
						<view class="cangkuyuan_baoguoliebiao_item3_w1 pcicang" v-if="arrlist.packageimage.length >0">
							<view class="baoguopic dairuku_top_l">
								<image :src="imgUrl + '/dzx_img30.png'"></image>
								<text>{{ $t('page_dairuku_xq.package_image') }}</text>
							</view>
						</view>
						<view class="index_item5_cont_bottom_img" :data-url="arrlist" @click="previewImage" v-if="arrlist.packageimage.length >0">
							<view class="index_item5_cont_bottom_imgs"
								v-for="(itemss, index1) in arrlist.packageimage"
								:data-url="itemss"
								:data-index="index1"
								@click="getIndex"
							>
								<image :src="itemss.file_path" mode="aspectFill"></image>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
// pages/shouye/shouye_zkc/shouye_zkc.js
const app = getApp();

let request = require('../../../utils/require');

export default {
	data() {
		return {
			navH: app.globalData.navHeight,
			gaodu: app.globalData.height,
			gaodutops: app.globalData.top,
			imgUrl: app.globalData.imgUrl,
			weight_mode: uni.getStorageSync('weight_mode'),
			price_mode: uni.getStorageSync('price_mode'),
			opentrue:true,
			arrlist: {
				express_name: '',
				express_num: '',

				country: {
					title: ''
				},
				packageimage:{},
				storage: {
					shop_name: ''
				},
				shop: '',
				price: '',
				remark: ''
			},
			artimages: [],
			imgindex: 0,
			index1: 0,
			optionsid: '',
			rtype: 1,
			setting:''
		};
	},
	/**
	 * 生命周期函数--监听页面加载
	 */ onLoad(options) {
		var that = this;
		that.optionsid = options.id
		that.rtype = options.rtype
		that.dairuku_xq();
	},
	onShow() {
		var that = this;
		that.settingFun();
	},
	/**
	 * 生命周期函数--监听页面初次渲染完成
	 */
	onReady: function() {},
	/**
	 * 生命周期函数--监听页面隐藏
	 */
	onHide: function() {},
	/**
	 * 生命周期函数--监听页面卸载
	 */
	onUnload: function() {},
	/**
	 * 页面相关事件处理函数--监听用户下拉动作
	 */
	onPullDownRefresh: function() {},
	/**
	 * 页面上拉触底事件的处理函数
	 */
	onReachBottom: function() {},
	/**
	 * 用户点击右上角分享
	 */
	onShareAppMessage: function() {},
	methods: {
		//设置
		settingFun() {
			var that = this;
			var data = {
				token: uni.getStorageSync('token')
			};
			request.post(`index.php?s=/api/page/service&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
				if (res.data.code == 1) {
					that.setting = res.data.data.values;
					uni.setStorageSync('setting', res.data.data.values);
					uni.setStorageSync('paytype', res.data.data.paytype);
					uni.setStorageSync('copyright', res.data.data.copyright);
					uni.setStorageSync('userclient', res.data.data.userclient);
					uni.setStorageSync('weight_mode', res.data.data.values.weight_mode);
					uni.setStorageSync('price_mode', res.data.data.values.price_mode);
					uni.setStorageSync('appname', res.data.data.values.name);
					uni.setStorageSync('is_packagestation', res.data.data.values.is_packagestation);
					uni.setStorageSync('is_categorysearch', res.data.data.values.is_categorysearch);
					uni.setStorageSync('address_setting', res.data.data.values.address_setting);
					uni.setStorageSync('menu_type', res.data.data.values.menu_type);
				} else {
					uni.showToast({
						title: res.data.msg,
						icon: 'none'
					});
				}
			});
		},
		//复制
		fuzhi: function(e) {
			var that = this;
			uni.setClipboardData({
				data: e.currentTarget.dataset.name,
				success: function(res) {
					uni.getClipboardData({
						success: function(res) {
							uni.showToast({
								title:that.$t('page_other.复制成功')
							});
						}
					});
				}
			});
		},
		jumpzuo() {
			console.log(this.rtype, 75342);
			if (this.rtype == 10) {
				uni.navigateTo({
					url: '/pages/index/index'
				});
			}
			uni.navigateBack();
		},
		getIndex(e) {
			this.imgindex = e.currentTarget.dataset.index
		},
		previewImage(e) {
			console.log(e, 88888);
			var len = e.currentTarget.dataset.url.packageimage.length;
			console.log(len, 88888);
			var artimages = this.artimages;
			for (var i = 0; i < len; i++) {
				artimages[i] = e.currentTarget.dataset.url.packageimage[i].file_path;
			}
			uni.previewImage({
				current: this.imgindex,
				urls: this.artimages
			});
		},
		dairuku_xq() {
			var that = this;
			var data = {
				token: uni.getStorageSync('token'),
				id: that.optionsid,
				method: 'edit'
			};
			request.post(`index.php?s=/api/package/details&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
				if (res.data.code == 1) {
					that.arrlist = res.data.data
					console.log(that.arrlist,888);
				}
			});
		}
	}
};
</script>
<style>
@import './dairuku_xq.css';
</style>
